home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / biz / dbase / mSQL_2_0b3.lha / msql / include / msql.h < prev    next >
C/C++ Source or Header  |  1998-01-04  |  3KB  |  129 lines

  1. /*
  2. **    msql.h    - 
  3. **
  4. **
  5. ** Copyright (c) 1993-95  David J. Hughes
  6. ** Copyright (c) 1995  Hughes Technologies Pty Ltd
  7. **
  8. ** Permission to use, copy, and distribute for non-commercial purposes,
  9. ** is hereby granted without fee, providing that the above copyright
  10. ** notice appear in all copies and that both the copyright notice and this
  11. ** permission notice appear in supporting documentation.
  12. **
  13. ** This software is provided "as is" without any expressed or implied warranty.
  14. **
  15. ** ID = "$Id:"
  16. **
  17. */
  18.  
  19.  
  20. #ifndef MSQL_H
  21. #define MSQL_H
  22.  
  23.  
  24. #if defined(__STDC__) || defined(__cplusplus)
  25. #  define __ANSI_PROTO(x)    x
  26. #else
  27. #  define __ANSI_PROTO(x)    ()
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. typedef    char    ** m_row;
  35.  
  36. typedef struct field_s {
  37.     char    *name,
  38.         *table;
  39.     int    type,
  40.         length,
  41.         flags;
  42. } m_field;
  43.  
  44.  
  45.  
  46. typedef    struct    m_data_s {
  47.     int    width;
  48.     m_row    data;
  49.     struct    m_data_s *next;
  50. } m_data;
  51.  
  52. typedef struct m_fdata_s {
  53.     m_field    field;
  54.     struct m_fdata_s *next;
  55. } m_fdata;
  56.  
  57.  
  58.  
  59. typedef struct result_s {
  60.         m_data     *queryData,
  61.                 *cursor;
  62.     m_fdata    *fieldData,
  63.         *fieldCursor;
  64.     int    numRows,
  65.         numFields;
  66. } m_result;
  67.  
  68.  
  69. #define    msqlNumRows(res) res->numRows
  70. #define    msqlNumFields(res) res->numFields
  71.  
  72.  
  73. #define INT_TYPE    1
  74. #define CHAR_TYPE    2
  75. #define REAL_TYPE    4
  76. #define IDENT_TYPE    8
  77. #define NULL_TYPE    16
  78. #define TEXT_TYPE    32
  79. #define LAST_REAL_TYPE    32
  80. #define UINT_TYPE    64
  81. #define IDX_TYPE    253
  82. #define SYSVAR_TYPE    254
  83. #define    ANY_TYPE    255
  84.  
  85. #define NOT_NULL_FLAG   1
  86. #define UNIQUE_FLAG    2
  87.  
  88. #define IS_UNIQUE(n)    (n & UNIQUE_FLAG)
  89. #define IS_NOT_NULL(n)    (n & NOT_NULL_FLAG)
  90.  
  91.  
  92. /*
  93. ** Pre-declarations for the API library functions
  94. */
  95. #ifndef _MSQL_SERVER_SOURCE
  96.     extern  char msqlErrMsg[];
  97.     int     msqlConnect __ANSI_PROTO((char *));
  98.     int     msqlSelectDB __ANSI_PROTO((int, char*));
  99.     int     msqlQuery __ANSI_PROTO((int, char*));
  100.     int     msqlCreateDB __ANSI_PROTO((int, char*));
  101.     int     msqlDropDB __ANSI_PROTO((int, char*));
  102.     int     msqlShutdown __ANSI_PROTO((int));
  103.     int     msqlGetProtoInfo __ANSI_PROTO((void));
  104.     int     msqlReloadAcls __ANSI_PROTO((int));
  105.     char     *msqlGetServerInfo __ANSI_PROTO((void));
  106.     char     *msqlGetHostInfo __ANSI_PROTO((void));
  107.     void    msqlClose __ANSI_PROTO((int));
  108.     void     msqlDataSeek __ANSI_PROTO((m_result*, int));
  109.     void     msqlFieldSeek __ANSI_PROTO((m_result*, int));
  110.     void     msqlFreeResult __ANSI_PROTO((m_result*));
  111.         m_row   msqlFetchRow __ANSI_PROTO((m_result*));
  112.     m_field    *msqlFetchField __ANSI_PROTO((m_result *));
  113.     m_result *msqlListDBs __ANSI_PROTO((int));
  114.     m_result *msqlListTables __ANSI_PROTO((int));
  115.     m_result *msqlListFields __ANSI_PROTO((int, char*));
  116.     m_result *msqlListIndex __ANSI_PROTO((int, char*, char*));
  117.     m_result *msqlStoreResult __ANSI_PROTO((void));
  118. #endif
  119.  
  120. int    msqlLoadConfigFile __ANSI_PROTO((char *));
  121. int     msqlGetIntConf __ANSI_PROTO((char *));
  122. char     *msqlGetCharConf __ANSI_PROTO((char*));
  123.  
  124.  
  125. #ifdef __cplusplus
  126.     }
  127. #endif
  128. #endif /*MSQL_H*/
  129.